AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')

ENT.WireDebugName = "BGP"

function ENT:Initialize()
	
	self:PhysicsInit(SOLID_VPHYSICS)
	self:SetMoveType(MOVETYPE_VPHYSICS)
	self:SetSolid(SOLID_VPHYSICS)
	
	if (!WireLib.DT["BITMAP"]) then
		WireLib.DT["BITMAP"]={Zero = {}}
	end

	self.Inputs = WireLib.CreateSpecialInputs(self, { "Bitmap" }, { "BITMAP" } )
	--self.Outputs = Wire_CreateOutputs(self, { "Memory" })
	
	--self.Memory = {}
	
	self.ScreenWidth = 512
	self.ScreenHeight = 512
end

--function ENT:ReadCell(Address)
--
--end

hook.Add("Think", "reset", function()

end)

--function ENT:WriteCell(Address, value)
--	
--end

function ENT:Think()

	return true
end


function MakeWireBGP( pl, Pos, Ang, model)
	
	if ( !pl:CheckLimit( "wire_BGP" ) ) then return false end
	
	local wire_BGP = ents.Create( "gmod_wire_BGP" )
	if (!wire_BGP:IsValid()) then return false end
	wire_BGP:SetModel(model)
	
	wire_BGP:SetAngles( Ang )
	wire_BGP:SetPos( Pos )
	wire_BGP:Spawn()
	
	wire_BGP:SetPlayer(pl)
	
	pl:AddCount( "wire_BGP", wire_BGP )
	
	return wire_BGP
end

duplicator.RegisterEntityClass("gmod_wire_BGP", MakeWireBGP, "Pos", "Ang", "Model")
